package com.hy.service.service;

import com.hy.service.OrderService;
import com.hy.service1.HelloService;
import com.hy.service1.UserService;
import org.apache.thrift.TException;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

@Service
public class OrderServiceImpl implements OrderService {

    @Resource
    private UserService userService;

    @Resource(name = "helloService")
    private HelloService.Iface helloService;

    @Override
    public Map<String, Object> getOrderMessage(Integer id) {
        String username = userService.getUserNameById(id);
        Map<String, Object> map = new HashMap<>();
        map.put("id", id);
        map.put("username", username);
        try {
            map.put("helloServiceResult", helloService.helloString("黄悦"));
        } catch (TException e) {
            e.printStackTrace();
        }
        return map;
    }

}
